package cn.zl.ymcc.mqCoumser;

import cn.zl.ymcc.dto.StationDto;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Select;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(//"course:station"
        topic = "course",
        selectorExpression = "station",
        consumerGroup = "course_station_group",
        messageModel = MessageModel.CLUSTERING,
        maxReconsumeTimes = 3
)
public class StationListenr implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt messageExt) {
        String s = new String(messageExt.getBody());
        StationDto stationDto = JSONObject.parseObject(s, StationDto.class);
        System.err.println(stationDto);

    }
}
